using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;using THSERP.BusinessEntities;using THSERP.BaseProvider;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using THSLib;using THSERP.BaseProvider;

namespace THSERP.Modules.CompanyConstant
{
    public partial class guiConfigPaymentMethod : THSERPScreen
    {
        public DataTable tblConfigPaymentMethod = new DataTable();
        public guiConfigPaymentMethod()
        {
            InitializeComponent();
        }

        private void guiConfigPaymentMethod_Load(object sender, EventArgs e)
        {
            tblConfigPaymentMethod = ADConfigValueUtility.InitConfigValueTable(ADConfigValueUtility.ADConfigValuePaymentMethod);
            fld_dgcPaymentMethod.DataSource = tblConfigPaymentMethod;
        }

        public void SaveConfigPaymentMethod()
        {
            foreach (DataRow rowPaymentMethod in tblConfigPaymentMethod.Rows)
            {
                String strPaymentMethodValue = rowPaymentMethod["Text"].ToString();
                String strADConfigValueColumnName = rowPaymentMethod["Value"].ToString();
                if (!String.IsNullOrEmpty(strPaymentMethodValue))
                    ADConfigValueUtility.UpdateValueToADConfigValueTable(strADConfigValueColumnName, strPaymentMethodValue);
            }
        }

        private void fld_btnSave_Click(object sender, EventArgs e)
        {
            SaveConfigPaymentMethod();
            MessageBox.Show("Gespeichert", "#Message#");
        }

        private void fld_btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

    }
}